import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:opnvpn_flutter/opnvpn_flutter.dart';
import 'package:opnvpn_flutter/opnvpn_flutter_platform_interface.dart';
import 'package:opnvpn_flutter/opnvpn_flutter_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockOpnvpnFlutterPlatform
    with MockPlatformInterfaceMixin
    implements OpnvpnFlutterPlatform {
  @override
  Future<String?> getPlatformVersion() => Future.value('42');

  @override
  void connect(String config, String name,
      {String? username,
      String? password,
      List<String>? bypassPackages,
      bool certIsRequired = false}) {
    // TODO: implement connect
  }

  @override
  void disconnect() {
    // TODO: implement disconnect
  }

  @override
  Future<void> initialize(
      {String? providerBundleIdentifier,
      String? localizedDescription,
      String? groupIdentifier,
      Function(VpnStatus status)? lastStatus,
      Function(VPNStage status)? lastStage}) {
    // TODO: implement initialize
    throw UnimplementedError();
  }

  @override
  Future<bool> isConnected() {
    // TODO: implement isConnected
    throw UnimplementedError();
  }

  @override
  Future<bool> requestPermissionAndroid() {
    // TODO: implement requestPermissionAndroid
    throw UnimplementedError();
  }

  @override
  Future<VPNStage> stage() {
    // TODO: implement stage
    throw UnimplementedError();
  }

  @override
  Future<VpnStatus> status() {
    // TODO: implement status
    throw UnimplementedError();
  }
}

void main() {
  final OpnvpnFlutterPlatform initialPlatform = OpnvpnFlutterPlatform.instance;

  test('$MethodChannelOpnvpnFlutter is the default instance', () {
    initialPlatform.status().then((value) => debugPrint(value?.byteIn));
    // expect(initialPlatform, isInstanceOf<MethodChannelOpnvpnFlutter>());
  });

  test('status', () async {
    OpnvpnFlutter opnvpnFlutterPlugin = OpnvpnFlutter();
    MockOpnvpnFlutterPlatform fakePlatform = MockOpnvpnFlutterPlatform();
    OpnvpnFlutterPlatform.instance = fakePlatform;

    expect(await opnvpnFlutterPlugin.getPlatformVersion(), '42');
  });
}
